package edu.uclm.esi.tysw.tusEntradas.persistence;

import java.sql.CallableStatement;
import java.sql.SQLException;

import edu.uclm.esi.tysw.tusEntradas.domain.Butaca;

public class ButacaDAO {

	public static void insert(Butaca butaca) throws SQLException {
		Conexion bd = Broker.get().getBD();
		try {
			CallableStatement cs=bd.prepareCall("{call crearButaca (?, ?, ?, ?)}");
			cs.setInt(1, butaca.getNumero());
			cs.setDouble(2, butaca.getPrecio());
			cs.setString(3, butaca.getTipo());
			cs.setString(4, butaca.getRecinto());
			cs.executeUpdate();
		}
		finally {
			bd.close();
		}
	}
	
	public static void getButacas() throws SQLException {
		Conexion bd = Broker.get().getBD();
		try {
			CallableStatement cs=bd.prepareCall("{call crearButaca (?, ?, ?, ?)}");
			//cs.setInt(1, butaca.getNumero());
			//cs.setDouble(2, butaca.getPrecio());
			//cs.setString(3, butaca.getTipo());
			//cs.setString(4, butaca.getRecinto());
			//cs.executeUpdate();
		}
		finally {
			bd.close();
		}
	}
	
	
}
